﻿Public Class BugReport
    Public mails_limit
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If mails_limit > 3 Then
            MsgBox("You can't submit more than 3 bugs in a single day.")
        Else
            mails_limit = mails_limit + 1
            If TextBox1.Text.Length > 0 And ComboBox1.Text.Length > 0 Then
                Dim msg As New System.Net.Mail.MailMessage
                msg.To.Add("sparda-x@hotmail.com")
                msg.From = New System.Net.Mail.MailAddress("user@l2connector.com", "L2Connector", System.Text.Encoding.UTF8)
                msg.Subject = "L2Connector Bug Report"
                msg.SubjectEncoding = System.Text.Encoding.UTF8
                msg.Body = "Bug type: " & ComboBox1.Text
                msg.Body = msg.Body & vbNewLine & "Information: " & vbNewLine & TextBox1.Text
                If CheckBox1.Checked = True Then
                    msg.Body = msg.Body & vbNewLine & "Log Text: " & vbNewLine & Form1.TextBox1.Text
                Else
                End If
                If CheckBox2.Checked = True Then
                Else
                    msg.Body = msg.Body & vbNewLine & "User Info: " & vbNewLine & "IP: " & Form1.ipaddress.Text & vbNewLine & "OS: " & Environment.OSVersion.ToString & vbNewLine & "DATE TIME: " & DateTime.Now.ToString
                End If
                msg.BodyEncoding = System.Text.Encoding.UTF8
                msg.IsBodyHtml = False
                msg.Priority = Net.Mail.MailPriority.High
                Dim client As New System.Net.Mail.SmtpClient
                client.Credentials = New System.Net.NetworkCredential("KKlogg123@gmail.com", "123Db123")
                client.Port = 587
                client.Host = "smtp.gmail.com"
                client.EnableSsl = True
                Try
                    client.Send(msg)
                    MsgBox("Thank you for reporting a bug.")
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            Else
                MsgBox("Please fill in all fields.")
            End If
        End If
    End Sub

    Private Sub TextBox1_Mousehover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseHover
        If TextBox1.Text = "Please describe here what you did when you experienced the bug." Then
            TextBox1.Text = ""
        Else
        End If
    End Sub

    Private Sub TextBox1_Mouseleave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseLeave
        If TextBox1.Text = "" Then
            TextBox1.Text = "Please describe here what you did when you experienced the bug."
        End If
    End Sub

    Private Sub BugReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class